using Rewired;
using UnityEngine;
using UnityEngine.UI;

namespace __Naptime.Script.Adapter
{
	public class CoinChaetConsole : MonoBehaviour
	{
		[SerializeField]
		[Min(0f)]
		private int money = 10000;

		[SerializeField]
		private Button addCoins;

		[SerializeField]
		private Button removeCoins;

		private Player player;

		private bool _wasReleased;

		private void Awake()
		{
			Object.Destroy(base.gameObject);
			addCoins.onClick.AddListener(OnCoinsAdded);
			removeCoins.onClick.AddListener(OnCoinsAddedRemoved);
		}

		private void OnDestroy()
		{
			addCoins.onClick.RemoveListener(OnCoinsAdded);
			removeCoins.onClick.RemoveListener(OnCoinsAddedRemoved);
		}

		private void OnCoinsAdded()
		{
			NintendoPlayerPrefs.SetFloat("Money", NintendoPlayerPrefs.GetFloat("Money", 0f) + (float)money);
			Shop.Instance.CheckButtons();
		}

		private void OnCoinsAddedRemoved()
		{
			NintendoPlayerPrefs.SetFloat("Money", NintendoPlayerPrefs.GetFloat("Money", 0f) - (float)money);
		}
	}
}
